1. Field
This disclosure relates to circuits for converting a varying voltage level to a varying width pulse, more particularly to a circuit making that conversion such that the varying width pulse can be sampled.
2. Background
Optical couplers typically include an emitter and detector pair. The detector detects emission or lack of emission from the emitter. The emitter is typically a source of light, such as a Light-Emitting Diode (LED) and the detector may be a phototransistor. The voltage level output by the phototransistor is directly related to the amount of light detected from the emitter.
A common application of these pairs is in user pointing devices, such as a computer mouse. These devices may use the pairs in quadrature phase decoding. Quadrature phase decoding may be used to detect movement of an object. In a typical configuration, a decoder wheel is used, inset such that there are slots around the wheel. A phototransistor with two outputs A and B is positioned such that the A and B photosensors are aligned with the slots and offset so that their quadrature outputs are 90 degrees out of phase. As the decoder wheels spin, they determine the outputs for A and B as either one (1) or zero (0). This results in the A and B outputs, typically sine waves, being ninety degrees out of phase with each other. The two digital outputs then create four possible outputs, hence the name quadrature.
Alternatively, photosensors can be used to detect movement of other objects between the photosensor and the emitter. In some examples the emitters are light emitting diodes (LEDs). The LEDs are left in the ON state and interruption of the light emitted and the detector indicates movement of an object in between the two, whether that object is a decoder wheel shutter or some other type of object.
Converting the output of a photodetector to a 1 or 0 is difficult. Variations in output brightness of the LED, and photodetector sensitivity, along with manufacturing variations, may make it impractical to use a standard photodetector output value for the threshold. There may need to be a different threshold value for each photodetector output. To lower manufacturing costs, it's desirable that there be some sort of automatic method to find the threshold values of a wide range devices.
Another problem with any sensor with a binary output is the problem of what happens to the output when the input is sitting at the threshold value. The output could then be either a 1 or 0. Usually, system noise causes the input to vary slightly, which could cause the output to change, even though the wheel is not moving. The common way to prevent false movement is with some form of hysterisis. With hysterisis, there are two thresholds—a high threshold and a low one. With input voltage hysterisis, if the input is low, it has to cross the high threshold before the output changes, and conversely, if the input is high, it has to cross the low threshold. The two threshold points are far enough apart to prevent noise on the input from causing output oscillations. Voltage hysterisis is commonly done with positive feedback from the output back to the input, so the output value (state) determines the input voltage threshold.
If the computer mouse or object with the optical coupler has a limited power supply, such as a battery, leaving the LED ON indefinitely will unnecessarily consume power. However, pulsing the LED between OFF and ON could lead to inaccurate data because input hysterisis will not work unless the state information is saved away between pulses. One solution might be to have analog to digital converters on the inputs and convert the analog voltage to a digital value, which can then be stored in the microcontroller. The problem with this approach is the added cost of analog to digital converters on inputs. Some technique is needed that will allow the LED to be pulsed to save power yet provide accurate data.